<ui:composition xmlns="http://www.w3.org/1999/xhtml"
                xmlns:ui="http://java.sun.com/jsf/facelets"
                xmlns:p="http://primefaces.org/ui"
                xmlns:h="http://java.sun.com/jsf/html">


    <h:form id="toolbar-form">

        <p:toolbar>
            <p:toolbarGroup align="left">
                <p:commandButton icon="ui-icon-triangle-1-w" title="Ascunde panelul"
                                 onclick="mainLayout.toggle('west')"/>

                <p:selectBooleanButton value="#{treeAdministrationBean.moveActivated}" onLabel="move"
                                       offLabel="move" onIcon="ui-icon-check" offIcon="ui-icon-close"
                                       disabled="#{treeAdministrationBean.administrationActivated}">
                    <p:ajax update=":trees-panel" listener="#{treeAdministrationBean.onTreeNodeMove}"/>
                </p:selectBooleanButton>

                <p:selectBooleanButton value="#{treeAdministrationBean.administrationActivated}" onLabel="administrate"
                                       offLabel="administrate" onIcon="ui-icon-check" offIcon="ui-icon-close">
                    <p:ajax update=":trees-panel" listener="#{treeAdministrationBean.onAdministrationTree}"/>
                </p:selectBooleanButton>
            </p:toolbarGroup>
        </p:toolbar>

    </h:form>

    <p:outputPanel id="trees-panel" layout="block">
        <p:outputPanel layout="block" rendered="#{!treeAdministrationBean.administrationActivated}">
            <ui:include src="tree/view-tree.xhtml"/>
        </p:outputPanel>

        <p:outputPanel layout="block" rendered="#{treeAdministrationBean.administrationActivated}">
            <ui:include src="tree/role-administration-tree.xhtml"/>
        </p:outputPanel>
    </p:outputPanel>

</ui:composition>